package net.xiduth.game.player.quests;

import java.util.ArrayList;

import net.xiduth.Settings;
import net.xiduth.game.player.Player;

/**
 * Manages the players completed, started and not-started quests.
 * 
 * @author Apache Ah64
 */
public class QuestManager {

	/**
	 * The player reference.
	 */
	@SuppressWarnings("unused")
	private Player player;

	/**
	 * An array list holding all quests, completed, started and non-started.
	 */
	private ArrayList<Quest> quests = new ArrayList<Quest>(Settings.QUESTS);

	/**
	 * Construct a new {@code QuestManager} {@code Object}.
	 * 
	 * @param player
	 */
	public QuestManager(Player player) {
		this.player = player;
	}

	/**
	 * Start a new quest.
	 * 
	 * @param quest
	 *            The quest key.
	 * @param parameters
	 *            The parameters.
	 */
	public void startQuest(Object quest, Object[] parameters) {
		if (quest == null) {
			return;
		}
		Quest questInstance = Quests.getQuest(quest);
		quests.set(questInstance.questId, questInstance);
	}

	/**
	 * Initialize the quest manager.
	 */
	public void initialize() {
		refreshQuests();
	}

	/**
	 * Refresh the progress status of all quests in the quest tab.
	 */
	public void refreshQuests() {

	}

	/**
	 * Get the quests.
	 * 
	 * @return The array list holding all quests, completed, started and
	 *         not-started.
	 */
	public ArrayList<Quest> getQuests() {
		return quests;
	}

	/**
	 * Set a new quests array list.
	 * 
	 * @param quests
	 *            The array list holding all quests, completed, started and
	 *            not-started.
	 */
	public void setQuests(ArrayList<Quest> quests) {
		this.quests = quests;
	}

	/**
	 * A enum holding the quest progress types.
	 * 
	 * @author Apache Ah64
	 */
	public static enum Progress {

		/**
		 * The completed quest progress type.
		 */
		COMPLETED,

		/**
		 * The started quest progress type.
		 */
		STARTED,

		/**
		 * The not-started quest progress type.
		 */
		NOT_STARTED;
	}
}